Dataset Previews
First, initialize by adding tools and declare floating type
using GriddingMachine
using PkgUtility
using Plots
using Plots.PlotMeasures
ENV["GKSwstype"]="100";
FT = Float32;
# use this to fix the problem in generated preview.jl file
F1 = joinpath(@__DIR__, "../../Artifacts.toml");
F2 = joinpath(@__DIR__, "../../../Artifacts.toml");
GRIDDINGMACHINE_ARTIFACTS = (isfile(F1) ? F1 : F2);
predownload_artifact.(["GPP_MPI_v006_1X_8D", "GPP_VPM_v20_1X_8D",
"NPP_MODIS_1X_1Y", "canopy_height_20X_1Y",
"clumping_index_12X_1Y", "clumping_index_2X_1Y_PFT",
"land_mask_ERA5_4X_1Y", "leaf_area_index_4X_1M",
"leaf_chlorophyll_2X_7D", "leaf_traits_2X_1Y",
"river_maps_4X_1Y", "SIF_TROPOMI_740_1X_1M",
"surface_data_2X_1Y", "tree_density_12X_1Y"],
GRIDDINGMACHINE_ARTIFACTS);#=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # -=#=# # # 0.0% 0.1% 0.4% 1.3% ## 3.8% ######## 11.4% ########### 16.5% ############### 21.6% ################### 26.8% ####################### 32.2% ########################### 37.6% ############################## 42.9% ################################## 48.4% ###################################### 53.7% ########################################## 58.9% ############################################ 61.9% ################################################# 68.4% #################################################### 72.4% ####################################################### 76.5% ######################################################### 80.5% ############################################################ 84.6% ############################################################### 88.7% ################################################################## 92.8% ##################################################################### 97.0% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # 0.0% 0.1% 0.4% # 1.6% ### 5.4% ####### 10.3% ########### 15.5% ############### 21.1% ################### 27.1% ######################## 33.6% ############################# 40.5% ################################## 47.9% ######################################## 55.9% ############################################## 64.4% #################################################### 73.6% ############################################################ 83.5% ################################################################### 93.9% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # ###################### 30.9% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # -=#=# # # 0.3% # 2.6% #### 6.3% ################# 24.3% ################################################################# 90.9% ######################################################################## 100.0% ┌ Error: Hash Mismatch! │ Expected sha256: d883316717c758c69eaca38d413b28a551eefe7d30cdad0acd93cc082359f641 │ Calculated sha256: a260f9f81c616d495040950d8f2178009245582c2431daa05844c91816c7af71 └ @ Pkg.PlatformEngines /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/PlatformEngines.jl:1248 #=#=# ##O#- # ## 3.1% ################### 26.7% ########################################### 60.6% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # 1.0% #### 5.9% ############### 21.9% ###################################################### 75.2% ######################################################################## 100.0% ┌ Error: Hash Mismatch! │ Expected sha256: a6aade7eb54ab16f521b020de46f04c866f44b7c114aaa7e67c0c2f9ea269ded │ Calculated sha256: c0c3db6ada622a110677b34ccdeb898d939265cc171c9e8d40018e5e936826f7 └ @ Pkg.PlatformEngines /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/PlatformEngines.jl:1248 #=#=# ######################################################################## 100.0%##O#- # ##=O#- # #-#O=# # #=#=-# # -#O#- # # -=#=-# # # -=O#- # # # -=O=# # # # -=O=-# # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # ######## 11.4% ############################################################ 84.5% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # -=#=# # # -=O#- # # # -=O=# # # # -=O=-# # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # -=O=- # # # # # 2.0% ##### 7.8% ############### 21.9% ################################################ 67.4% ######################################################################## 100.0% ┌ Error: Hash Mismatch! │ Expected sha256: e9a849a731469191f366c5d0fcd21aed8c027824c33da5925b989174accfc9f6 │ Calculated sha256: 75ed9c65f80fd9f840fea6c7c5a85ee88c4d46bb5116d389736944f1d71ff2f3 └ @ Pkg.PlatformEngines /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/PlatformEngines.jl:1248 #=#=# ########## 14.5% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # # 2.1% ######## 12.2% ########################### 38.5% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # 0.2% 0.8% # 2.8% ####### 10.1% ########################### 38.4% ########################################################### 82.6% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # 0.2% 1.2% ## 3.3% ######## 12.2% ################################## 47.3% ###################################################################### 97.9% ######################################################################## 100.0% ┌ Error: Hash Mismatch! │ Expected sha256: 912f3638c440948e14b6aa28a843d3f576da12d838228210f7c2da18eed0123d │ Calculated sha256: 60fde21883b73ab7132b3c247675c44b18e0f22bbd8e7fb1b9627af8254ed161 └ @ Pkg.PlatformEngines /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/PlatformEngines.jl:1248 #=#=# ##O#- # ## 3.0% ############ 17.9% ############################ 39.1% ################################################## 70.1% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # 1.0% ### 4.8% ########### 16.2% ############################################## 64.2% ######################################################################## 100.0% ┌ Error: Hash Mismatch! │ Expected sha256: fd45618e762c9763efe8d6e5b976efdd2318473d7d22d84f557480974e9d42b3 │ Calculated sha256: 7b61104c7505b592c5bbb48d64e0bd4b73340f850958d23484b49c39860ae0bc └ @ Pkg.PlatformEngines /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/PlatformEngines.jl:1248 #=#=# ######################################################################## 100.0% ############# 19.0% ########################################################### 82.3% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # 0.3% # 1.5% ### 5.0% ############# 19.1% ############################################### 66.0% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # 0.1% 0.4% # 1.9% ##### 7.2% ################## 25.6% ################################### 49.6% ###################################################### 75.2% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # 0.0% 0.1% 0.3% 1.0% ## 3.6% #### 6.9% ####### 10.4% ########## 14.1% ############# 18.1% ################ 22.4% ################### 27.0% ####################### 32.0% ########################## 37.3% ############################## 42.9% ################################### 48.9% ####################################### 54.8% ########################################### 60.6% ############################################### 66.5% #################################################### 72.4% ######################################################## 78.0% ############################################################ 83.9% ################################################################ 89.8% #################################################################### 95.6% ######################################################################## 100.0% #=#=# ##O#- # ##O=# # #=#=-# # -#O#- # # 0.3% 1.1% ### 5.4% ############ 17.9% ############################################## 64.0% ######################################################################## 100.0%
Then, define a function to plot the dataset
function preview_data(ds::GriddedDataset{FT}, ind::Int)
# preview data
return heatmap(view(ds.data,:,:,ind)',
origin="lower",
aspect_ratio=1,
xticks=[],
yticks=[],
c=:viridis,
size=(700,300),
framestyle=:none)
end
function preview_data(ds::GriddedDataset{FT}, ind::Int, clim::Tuple)
# preview data
return heatmap(view(ds.data,:,:,ind)',
origin="lower",
aspect_ratio=1,
xticks=[],
yticks=[],
c=:viridis,
clim=clim,
size=(700,300),
framestyle=:none)
endpreview_data (generic function with 2 methods)
Leaf level datasets
Leaf chlorophyll content
LCH_LUT = load_LUT(LeafChlorophyll{FT}());
mask_LUT!(LCH_LUT, FT[0,Inf]);
LCH_LUT = regrid_LUT(LCH_LUT, Int(size(LCH_LUT.data,2)/180));
anim = @animate for i ∈ 1:size(LCH_LUT.data,3)
preview_data(LCH_LUT, i, (0,80));
end
gif(anim, fps=5)Leaf nitrogen content
LNC_LUT = load_LUT(LeafNitrogen{FT}());
mask_LUT!(LNC_LUT, FT[0,Inf]);
LNC_LUT = regrid_LUT(LNC_LUT, Int(size(LNC_LUT.data,2)/180));
preview_data(LNC_LUT, 1)
Leaf phosphorus content
LPC_LUT = load_LUT(LeafPhosphorus{FT}());
mask_LUT!(LPC_LUT, FT[0,Inf]);
LPC_LUT = regrid_LUT(LPC_LUT, Int(size(LPC_LUT.data,2)/180));
preview_data(LPC_LUT, 1)
Specific leaf area
SLA_LUT = load_LUT(LeafSLA{FT}());
mask_LUT!(SLA_LUT, FT[0,Inf]);
SLA_LUT = regrid_LUT(SLA_LUT, Int(size(SLA_LUT.data,2)/180));
preview_data(SLA_LUT, 1)
Vcmax
VCM_LUT = load_LUT(VcmaxOptimalCiCa{FT}());
mask_LUT!(VCM_LUT, FT[0,Inf]);
VCM_LUT = regrid_LUT(VCM_LUT, Int(size(VCM_LUT.data,2)/180));
preview_data(VCM_LUT, 1)
Stand level datasets
Canopy height
CHT_LUT = load_LUT(CanopyHeightGLAS{FT}());
mask_LUT!(CHT_LUT, FT[0,Inf]);
CHT_LUT = regrid_LUT(CHT_LUT, Int(size(CHT_LUT.data,2)/180));
preview_data(CHT_LUT, 1)
Clumping index
# global clumping index
CLI_LUT = load_LUT(ClumpingIndexMODIS{FT}(), "12X", "1Y");
mask_LUT!(CLI_LUT, FT[0,1]);
CLI_LUT = regrid_LUT(CLI_LUT, Int(size(CLI_LUT.data,2)/180));
preview_data(CLI_LUT, 1, (0.4,1))
# global clumping index per PFT
CLI_LUT = load_LUT(ClumpingIndexPFT{FT}());
mask_LUT!(CLI_LUT, FT[0,1]);
CLI_LUT = regrid_LUT(CLI_LUT, Int(size(CLI_LUT.data,2)/180));
anim = @animate for i ∈ 1:size(CLI_LUT.data,3)
preview_data(CLI_LUT, i, (0.4,1));
end
gif(anim, fps=1)Gross primary productivity
# GPP MPI
anim = @animate for year ∈ 2001:2019, i ∈ 1:46
GPP_LUT = load_LUT(GPPMPIv006{FT}(), year, "1X", "8D");
mask_LUT!(GPP_LUT, FT[-100,Inf]);
preview_data(GPP_LUT, i, (0,10));
end
gif(anim, fps=20)